function [Tu, Ta, K] = identificar(time, in, out, N, textos)
K = max(out);
in = in(1:N);
out = out(1:N);
time = time(1:N);
% Punto de maxima pendiente
[p,idx] = max(diff(out));
% Ecuacion de la recta
m = (out(idx+1) - out(idx))/(time(idx+1) - time(idx));
y0 = out(idx)-m*time(idx);
% Parametros del modelo
Tu = -y0 / m;
Tt = (K - y0) / m;
Ta = Tt - Tu;
% Plot de los resultados
plot(time,[in out])
hold on; grid on;
% Recta
ty = Tu:(Tt-Tu)/100:Tt;
y = m*ty + y0;
plot(ty,y,'r','LineWidth',2);
legend(textos{1},textos{2},textos{3});
axis([0 time(N) 0 K*1.05]);
% Linea en Ta
lineTa = 0:K/100:K; 
plot(ones(length(lineTa))*Tt,lineTa,'--k');
% Lineas Maxima Pendiente
xMax = 0:out(idx)/100:out(idx);
plot(ones(length(xMax))*time(idx),xMax,'--k');
yMax = 0:time(idx)/100:time(idx);
plot(yMax,ones(length(yMax))*out(idx),'--k');
% Textos
text(time(idx)+1,out(idx),'Punto de maxima pendiente');
text(Tu+1,out(idx)/5,strcat('Tu=',num2str(Tu)));
text(Tt+0.5,out(idx)/5,strcat('Tu+Ta=',num2str(Tt)));
% Linea K
lineK = 0:time(N)/100:time(N);
plot(lineK,ones(length(lineK))*K,'--k');
% Labels
title(textos{4});
xlabel('Tiempo (s)');
ylabel('Voltaje (V)');
